<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <table border="1" cellspacing="0">
            <thead>
                <tr>
                    <th></th>
                    <th>id</th>
                    <th>名称</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr v-for="(item,index) in list" :key="item.id">
                    <td><input type="checkbox"></td>
                    <td>{{item.id}}</td>
                    <td>{{item.title}}</td>
                    <td><button @click="del(index)">删除</button></td>

                </tr>
            </tbody>
        </table>
    </div>
    <script src="./vue.global.js"></script>
    <script>
        const {createApp} = Vue;
        createApp({
            data(){
                return {
                   list:[
                    {id:1,title:'手机'},
                    {id:2,title:'电脑'},
                    {id:3,title:'瓜子'}
                   ]
                }
            },
           methods:{
            del(index){
                this.list.splice(index,1)
            }
           }
        }).mount('#app')
    </script>
</body>
</html>